package com.heavenick.app.service.impl;

import java.util.HashMap;
import java.util.Map;

import com.heavenick.app.model.pojo.Simple;
import com.heavenick.app.service.SimpleService;

public class SimpleServiceImpl implements SimpleService {
	
	public static Map<Integer,Simple> map  = new HashMap<Integer,Simple>();
	
	public Integer save(String name, String age) {
		
		Integer id = map.size()+1;
		
		System.out.println(map.size() + "id " + id);
		Simple simple = new Simple();
		simple.setAge(age);
		simple.setName(name);
		simple.setId(id);
		map.put(id, simple);
		return id;
	}

	public Simple delete(Integer id) {
		return map.remove(id);
	}

	public boolean update(Integer id, String name) {
		Simple simple = map.get(id);
		simple.setName(name);
		return true;
	}

	public Simple query(Integer id) {
		return map.get(id);
	}
}